class RviewsController < ApplicationController
  # GET /rviews
  # GET /rviews.xml
  def index
    @rviews = Rview.find(:all)

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @rviews.to_xml }
    end
  end

  # GET /rviews/1
  # GET /rviews/1.xml
  def show
    @rview = Rview.find(params[:id])

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @rview.to_xml }
    end
  end

  # GET /rviews/new
  def new
    @rview = Rview.new
  end

  # GET /rviews/1;edit
  def edit
    @rview = Rview.find(params[:id])
  end

  # POST /rviews
  # POST /rviews.xml
  def create
    @rview = Rview.new(params[:rview])

    respond_to do |format|
      if @rview.save
        flash[:notice] = 'Rview was successfully created.'
        format.html { redirect_to rview_url(@rview) }
        format.xml  { head :created, :location => rview_url(@rview) }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @rview.errors.to_xml }
      end
    end
  end

  # PUT /rviews/1
  # PUT /rviews/1.xml
  def update
    @rview = Rview.find(params[:id])

    respond_to do |format|
      if @rview.update_attributes(params[:rview])
        flash[:notice] = 'Rview was successfully updated.'
        format.html { redirect_to rview_url(@rview) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @rview.errors.to_xml }
      end
    end
  end

  # DELETE /rviews/1
  # DELETE /rviews/1.xml
  def destroy
    @rview = Rview.find(params[:id])
    @rview.destroy

    respond_to do |format|
      format.html { redirect_to rviews_url }
      format.xml  { head :ok }
    end
  end
end
